<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="//cdn.bootcss.com/pako/1.0.6/pako.min.js"></script>
    <script src="//cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
</head>
<body>
    
    <div id="info">

    </div>

    <script>
        var ws = new WebSocket('wss://api.huobi.pro/ws');


        ws.onopen = function() {

        }

        ws.onmessage = function (ret) {
            var data = ret.data;

            consoloe.log(data);
        }

        ws.onclose = function() { 
            
        };       

        function _log(data) {
            console.log(data);
        }

        function unzip(b64Data){
            var strData     = atob(b64Data);
            
            // Convert binary string to character-number array
            var charData    = strData.split('').map(function(x){return x.charCodeAt(0);});
        
        
            // Turn number array into byte-array
            var binData     = new Uint8Array(charData);
        
        
            // // unzip
            var data        = pako.inflate(binData);
        
        
            // Convert gunzipped byteArray back to ascii string:
            strData     = String.fromCharCode.apply(null, new Uint16Array(data));
            return strData;
        }
        
        
        function zip(str){
            var binaryString = pako.gzip(str, { to: 'string' });
            
            return btoa(binaryString);
        }
    </script>
</body>
</html>